home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 042a / bpl70n11.zip / README.DOC < prev    next >
Text File  |  1993-03-12  |  18KB  |  340 lines

  1.      Borland-Pascal 7.0 Runtime Libary Update - Release 1.0   03-15-1992
  2.  
  3.  
  4.      Welcome to BPL70N11.ZIP, a collection of fast replacement libraries
  5.      for your Turbo Pascal 7.0 / Borland Pascal 7.0 compiler. There are
  6.      three libraries in this package, a real mode library (TURBO.TPL), a
  7.      DOS protected mode library (TPP.TPL) and a Windows library (TPW.TPL).
  8.      Every file is a complete replacement for the original library bearing
  9.      the same name that came with your Pascal compiler. Due to the many
  10.      optimizations in the replacement libraries, many programs compiled
  11.      with these libraries will run faster. For more detailed information
  12.      on possible performance improvements, check the file PERFORM.DOC. Only
  13.      performance information for real mode and DOS protected mode programs
  14.      can be provided at the moment.
  15.  
  16.      Those users already familiar with my previous project, the fast
  17.      replacement library for Turbo Pascal 6.0 (distributed as TPL60N19.ZIP),
  18.      may be disappointed that not all the features of that program have
  19.      been included in BPL70N11.ZIP yet. I don't have much time at the moment,
  20.      but still wanted to provide a BP 7.0 version of my library as soon as
  21.      possible. So I decided to port the performance relevant stuff first
  22.      and work on the other aspects later.
  23.  
  24.      The libaries in BPL70N11 maintain 99.9% compatibility with the original
  25.      libraries. Differences are mostly caused by bug fixes and enhancements.
  26.      Some bugs from the original libraries supplied by Borland have been
  27.      eliminated, but there can be no guarantee that new ones have not crept
  28.      in. Most of the code in the BPL70N11.ZIP libraries was ported from the
  29.      latest version of my fast replacement library for Turbo Pascal 6.0,
  30.      TPL60N19.ZIP, which has been proven to be a stable and reliable product.
  31.  
  32.      If you discover any bugs, or have other comments, please let me know.
  33.      My email and snail mail addresses are given below. Although I am under
  34.      severe time constraints, I will try as hard as possible to fix any bugs
  35.      reported in as short a time as possible.
  36.  
  37.      The legal conditions under which Borland is distributing the source code
  38.      of the Borland Pascal 7.0 run-time libraries are not entirely clear to me.
  39.      To stay on the safe side, I assume that they are the same as for the RTL
  40.      source for the TP 6.0 compiler. Under these conditions, I am not allowed
  41.      to distribute modified source modules from the library. I may only
  42.      provide the binaries to third parties. However, some of the modules in
  43.      the BPL70N11.ZIP libaries do not contain a single line of code written
  44.      by Borland and are written entirely by me. I am including the source for
  45.      these modules for your reference. The source of the arithmetic routines
  46.      can be found in the file ARISOURC.ZIP. The source code of most of the
  47.      string routines is contained in the file STRSOURC.ZIP. The code of the
  48.      arithmetic and string routines is hereby released into the public domain.
  49.      You may use it in your own programs under the condition that you do not
  50.      include it into a commercial product. Parties interested in commercial
  51.      use of my code should contact me at my address below.
  52.  
  53.  
  54.      Original library code is Copyright (C) 1983,92 Borland International
  55.  
  56.  
  57.      New / additional library code is Copyright (C) 1988-1993
  58.  
  59.      Norbert Juffa, Wielandtstr. 14, 7500 Karlsruhe 1, Germany
  60.      Internet: S_JUFFA@IRAVCL.IRA.UKA.DE
  61.  
  62.  
  63.  
  64.      Contents of this document:
  65.  
  66.      I.   Capabilities of RTL replacement
  67.      II.  Revision History
  68.      III. References
  69.  
  70.  
  71.  
  72.      I. Capabilities of RTL replacement
  73.      ==================================
  74.  
  75.  
  76.      General note:
  77.  
  78.      BPL70N11 provides you with optimized libraries, it does not enhance
  79.      the code produced by the Borland Pascal compiler. Thus, only code
  80.      that uses many library calls can be expected to experience significant
  81.      performance advantages. Library calls are made by BP 7.0 to operate
  82.      on LONGINTs, STRINGs, REALs, SETs, perform heap operations such as
  83.      allocating and deallocating memory (New, Dispose, GetMem, FreeMem),
  84.      as well as to perform other tasks. One exception where BPL70N10 speeds
  85.      up your code although no calls to optimized library routines are
  86.      made is floating-point applications using a 287 or 387 coprocessor.
  87.  
  88.      If want to speed up your applications even further than can be
  89.      accomplished by using BPL70N11, you might want to look at the
  90.      "Sally TPU peephole optimizer" (SPO for short) written by Morten
  91.      Welinder (terra@diku.dk). Unlike BPL70N11, this program is not in
  92.      the public domain, but Morten grants free use of the program for
  93.      personal, non-commercial use during all of 1993. SPO is a peephole
  94.      optimizer that aims at optimizing the code produced by the Pascal
  95.      compiler. Peephole optimizations means that the optimizer looks at
  96.      a rather small collection of machine instructions at a time and
  97.      replaces certain sequences it finds with optimized code. A TPU-optimizer
  98.      speeds up those parts of a program that can't be enhanced by a
  99.      replacement library and vice versa. So it might be a good idea to
  100.      combine both tools to get the best performance out of your BP 7.0
  101.      programs. The SPO optimizer is currently distributed as a file
  102.      SPO110.ZIP, with the next version most likely going to be called
  103.      SPO120.ZIP. It should be available from all ftp-sites that carry
  104.      BPL70N11 and in particular can be downloaded from garbo.uwasa.fi,
  105.      which is the upload site for the program. Please note that this is
  106.      not intended to be an endorsement of the program. Rather, the info
  107.      provided should be thought of as being a service to those users of
  108.      BPL70N11 who want to speed up their programs even further than
  109.      possible by using BPL70N11.
  110.  
  111.  
  112.      Improvements in SYSTEM module
  113.      -----------------------------
  114.  
  115. o    REAL type software arithmetic operations now comply with ANSI/IEEE
  116.      Standard 754-1985 for Binary Floating Point Arithmetic [1,2] as much
  117.      as possible. Note that REAL arithmetic by design differs from the
  118.      standard in many ways, especially available numeric formats, value
  119.      set, and available operations. The rounding mode implemented here
  120.      is "round to nearest or even" as specified by the standard. Add,
  121.      Subtract, Multiply, Squaring, Division, and Square Root deliver
  122.      exact results with regard to this rounding mode, as demanded by the
  123.      standard. Conversions from REAL to LONGINT and from EXTENDED to REAL
  124.      use rounding to nearest or even, as specified in the standard. Correct
  125.      implementation of above features was tested with the PARANOIA test
  126.      program [3]. The correctness of basic REAL arithmetic functions has
  127.      also been tested against the coprocessor/emulator EXTENDED format
  128.      with the program FUN1_TST. The EXTENDED format carries approximately
  129.      19 decimal digits of precision. This description applies to all three
  130.      libraries in the package.
  131.  
  132. o    REAL arithmetic operations have been sped up. Speed-up for SQRT varies
  133.      between a factor of 11 for a 8086 and 30 for a 486DLC. FRAC now executes
  134.      at twice the original speed and speed-up is between 50% and 100% for
  135.      SIN, COS, ARCTAN, LN, EXP and division (2.8x speed up for division on
  136.      80386). Overall numeric processing power using REAL arithmetic increases
  137.      by about 52% for an 8086 and by 85% for an Cyrix 486DLC as measured
  138.      by the WHETSTONE benchmark [4,5]. This description applies to all three
  139.      libraries, but the actual values cited are for the real mode library
  140.      TURBO.TPL and may be different for the other libraries. In general,
  141.      DOS protected mode and Windows programs tend to be slower than real mode
  142.      programs by 5-50%.
  143.  
  144. o    Overall accuracy of REAL arithmetic transcendental functions has been
  145.      improved as indicated by Cody&Waite's ELEFUNT tests [6]: DLOG, DEXP,
  146.      DATAN, DSIN. Correct argument reduction ensures that relative error
  147.      over the whole argument range does not exceed 1.9e-12 for Exp, 2.8e-12
  148.      for Arctan, and 2.7e-12 for Ln. These values have been determined
  149.      by comparing the function returns of the REAL transcendental functions
  150.      to the values computed on a Cyrix 83D87 coprocessor for the EXTENDED
  151.      format. For Sin and Cos, relative error is also in the above range
  152.      when the argument is reasonably small (e.g. in range -100..100) and
  153.      not very close to an integer multiple of 0.25*Pi. The error of the
  154.      transcendental functions expressed in ULPs (units in the last place)
  155.      over the whole argument range does not exceed 1.6 ULPs for Exp, 1.8
  156.      ULPs for Arctan, and 2.2 ULPs for Ln. This description applies to all
  157.      three libraries in the package.
  158.  
  159. o    Execution of coprocessor floating point computations using an 80287 or
  160.      80387 has been accelerated. For these coprocessors, NOPs will be inserted
  161.      before every floating point instruction converted from an emulator
  162.      interrupt instead of WAITs. As a result of this optimization, an
  163.      improvement in execution speed of about 10% has been observed running the
  164.      Lawrence Livermore Loops (LLL) [7] on a Cyrix 83D87, the improvement
  165.      for the WHETSTONE benchmark on the 83D87 is similar. Maximum performance
  166.      gain for tight loops (e.g. fractal computation) by this measure is about
  167.      22%.
  168.  
  169. o    On 80287XL, 80387, 80486DX, or compatible chips the Sin and Cos functions
  170.      take advantage of the FSIN and FCOS instructions of these coprocessors,
  171.      speeding up these functions by almost a factor of two. As a side effect,
  172.      there is also some improvement in accuracy as measured by the DSIN test
  173.      program from the ELEFUNT test suite. Also, the Arctan function takes
  174.      advantage of the increased argument range of the FPATAN function. These
  175.      optimizations result in another 19% increase in WHETSTONE power, so
  176.      that the total combined speedup over the original library is about 30%
  177.      for this benchmark using a 387 coprocessor.
  178.  
  179. o    STRING operations are faster, especially for longer strings. Most
  180.      dramatic increase is in the INSERT function, with execution times
  181.      reduced to up to one fourth compared with the original version of
  182.      the RTL. Faster string operations cause 7% performance increase for
  183.      the DHRYSTONE [8,9] benchmark on a 8086.
  184.  
  185. o    Improved speed of random number generation. Random for REAL numbers
  186.      is 10-20% faster, Random for EXTENDED numbers is 5% faster. Due to
  187.      the improvements in the uniform distribution of integer random numbers,
  188.      there is a decrease in the speed of integer random number generation
  189.      of about 5%.
  190.  
  191. o    Binary to decimal conversions used in Str and Write procedures have
  192.      been sped up by up to 70% for integers (BYTE, SHORTINT, INTEGER,
  193.      WORD, LONGINT), up to 5% for REAL numbers and about 3% for EXTENDED
  194.      numbers.
  195.  
  196. o    Improved speed of LONGINT arithmetic for 8086..80286. Division enjoys
  197.      a 30% reduction of execution time on 8086. On 386 and 486 type CPUs,
  198.      the code used in BPL70N11 may be slower than that used by the original
  199.      library, which uses 32 bit register operations, while BPL70N11 uses
  200.      only 16 bit operations, however very cleverly. For most applications
  201.      you will not note any drop in LONGINT performance on 386/486 machines
  202.      by using BPL70N11.
  203.  
  204. o    Several of the functions of the heap manager have been tuned, resulting
  205.      in 7%-11% faster operation for these routines, depending on the CPU used.
  206.      This note applies only to the real mode heap manager in TURBO.TPL!
  207.  
  208. o    Set functions have been sped up by a few percent, but the add variable
  209.      range operation may be up to eight times as fast.
  210.  
  211. o    UPCASE function has been enhanced to support the complete IBM character
  212.      set. This means that characters ä,ü,ö,å,æ,é,ñ,ç are converted to upper
  213.      case by this function.
  214.  
  215. o    Several bugs of the original RTL supplied by Borland have been fixed:
  216.  
  217.      The original routines to perform LONGINT shifts provide the wrong results
  218.      when the program runs on a 386 or 486 type processor and the shift count
  219.      exceeds 16. This has been fixed by replacing all LONGINT routines with
  220.      my own code. My code doesn't use 386 specific instructions and foregoes
  221.      the speed advantage offered by using 32-bit register operations. For all
  222.      programs but a very few you will not notice any drop in performance on a
  223.      386-486 machine, though.
  224.  
  225.      GetDir now correctly returns a run-time error 15 (invalid drive)
  226.      when called with a non existent drive. Differing from the original,
  227.      it also signals all errors reported by DOS as run-time errors. E.g.
  228.      when applied to a floppy drive that does not contain a floppy, it
  229.      will now return run-time error 152 (drive not ready), where previously
  230.      it would incorrectly signal successful completion of the operation
  231.      (InOutRes = 0).
  232.  
  233.      For programs compiled with $N+, only true INFs are printed out as
  234.      INF where with the original library some NaNs are also printed as
  235.      INF. Correct operation can be tested with the INFBUG program.
  236.  
  237.      REAL arithmetic EXP functions no longer signals overflow when
  238.      called with small arguments, but underflows to zero instead as it
  239.      should.
  240.  
  241.      Denormals in EXTENDED computations no longer cause an invalid state
  242.      on a 8087 coprocessor when being converted to true zeros. Consistency
  243.      between register contents and tag bits is now asserted. Removal of
  244.      this bug can be tested with the BUG87 program.
  245.  
  246.      Denormals in EXTENDED format are now correctly converted to decimal
  247.      strings by the Str and Write routines. The original routines print
  248.      EXTENDED precision denormals as zero. Note that BP 7.0 supports
  249.      EXTENDED denormals only if your machine has an 80287XL, 80387, 80486
  250.      or equivalent. On the 8087 and Intel's original 80287 coprocessor
  251.      denormals are only supported for the SINGLE and DOUBLE formats. Correct
  252.      printing of extended precision denormals can be checked with the
  253.      program DENORMTS.
  254.  
  255.      Program initialization routine now tries to prevent that programs
  256.      compiled with the $G+ (286 code generation) switch are run on 8086
  257.      and 8088. The checks done are not 100% safe, but catch most of these
  258.      cases, displaying the message "CPU > 8086 required" and aborting the
  259.      program with a return code of 254 ($FE) instead of letting it crash.
  260.      Note that this check lets programs compiled with $G+ run on 80186 and
  261.      V20/V30 processors, since they have the ability to execute all 80286
  262.      real mode instructions produced by Turbo Pascal. This note applies
  263.      only to real mode programs, as DOS protected mode and Windows programs
  264.      will not run on anything less than a 286 anyhow.
  265.  
  266.  
  267.  
  268.      Improvements in CRT module
  269.      --------------------------
  270.  
  271. o    Bug fix in routine DirectWrite. The method used to prevent "snow"
  272.      when writing directly to a CGA graphics card was not entirely safe.
  273.      When used in a heavily interrupted program (e.g. serial communication
  274.      as a background task), it would not always write during the time
  275.      when scanning was in the invisible parts of the screen. The method
  276.      used now is 100% save and is even faster, since it takes advantage
  277.      of the horizontal and vertical retrace periods, as opposed to the
  278.      old method which only used the horizontal retrace time. The new
  279.      routine has been tested successfully on an original IBM-CGA card.
  280.  
  281.  
  282.  
  283.      II. Revision History
  284.      ====================
  285.  
  286.      Changes since Version 1.0, dated 03-10-1993
  287.  
  288. o    Fixed bug in LONGINT and REAL Val routine. Val erroneously returned
  289.      the wrong value or an error code for syntactically correct strings.
  290.      Thanks to Dennis J. Basiaga (dennisb@dancer.cc.bellcore.com), who was
  291.      the first to report this bug.
  292.  
  293.  
  294.      Version 1.0, original release.
  295.  
  296.  
  297.  
  298.      III. References
  299.      ===============
  300.  
  301. [1]  IEEE: IEEE Standard for Binary Floating-Point Arithmetic.
  302.      SIGPLAN Notices, Vol. 22, No. 2, 1985, pp. 9-25
  303.  
  304. [2]  IEEE Standard for Binary Floating-Point Arithmetic.
  305.      ANSI/IEEE Std 754-1985.
  306.      New York, NY: Institute of Electrical and Electronics Engineers 1985
  307.  
  308. [3]  Karpinski, R.: Paranoia: A Floating-Point Benchmark.
  309.      Byte, February 1985, pp. 223-235
  310.  
  311. [4]  Curnow, H.J.; Wichmann, B.A.: A synthetic benchmark.
  312.      Computer Journal, Vol. 19, No. 1, 1976, pp. 43-49
  313.  
  314. [5]  Wichmannn, B.A.: Validation code for the Whetstone benchmark.
  315.      NPL Report DITC 107/88, National Physics Laboratory, UK, March 1988
  316.  
  317. [6]  Cody, W.J.; Waite, W.: Software Manual for the Elementary Functions.
  318.      Englewood Cliffs, NJ: Prentice Hall 1980
  319.  
  320. [7]  McMahon, H.H.: The Livermore Fortran Kernels: A Test of the Numerical
  321.      Performance Range.
  322.      Technical Report UCRL-53745, Lawrence Livermore National Laboratory,
  323.      December 1986, p. 179
  324.  
  325. [8]  Weicker, R.P.: Dhrystone: A Synthetic Systems Programming Benchmark.
  326.      Communications of the ACM, Vol. 27, No. 10, October 1984, pp. 1013-1030
  327.  
  328. [9]  Weicker, R.P.: Dhrystone Benchmark: Rationale for Version 2 and
  329.      Measurement Rules.
  330.      SIGPLAN Notices, Vol. 23, No. 8, August 1988, pp. 49-62
  331.  
  332. [10] 387DX User's Manual, Programmer's Reference. Intel 1989
  333.  
  334.  
  335.      Note:
  336.  
  337.      PARANOIA, DHRYSTONE, WHETSTONE, LLL, and ELEFUNT source code is
  338.      available from NETLIB@ORNL.GOV
  339.  
  340.